home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / Bowers Development / AppMaker 2.0b5 / Examples / Windows MFC / MFC generated / mainfrm.cp < prev    next >
Text File  |  1996-01-01  |  3KB  |  131 lines

  1. // mainfrm.cpp -- Code for the application frame window in SDI app
  2. // Created 01/01/95 12:01 PM by AppMaker
  3.  
  4. #include "stdafx.h"
  5. #include "Demo1Dlg.h"
  6.  
  7. #include "mainfrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char BASED_CODE THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. //
  15. // class CMainFrame
  16. //
  17.  
  18. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  19.  
  20. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  21.     //{{AFX_MSG_MAP(CMainFrame)
  22.     // Handlers within the section marked by {{AFX_MSG_MAP and }}AFX_MSG_MAP
  23.     // are maintained by ClassExpress.    
  24.     ON_WM_CREATE()
  25.     //}}AFX_MSG_MAP
  26.  
  27.     ON_COMMAND(ID_HELP_INDEX, CFrameWnd::OnHelpIndex)
  28.     ON_COMMAND(ID_HELP_USING, CFrameWnd::OnHelpUsing)
  29.     ON_COMMAND(ID_HELP, CFrameWnd::OnHelp)
  30.     ON_COMMAND(ID_CONTEXT_HELP, CFrameWnd::OnContextHelp)
  31.     ON_COMMAND(ID_DEFAULT_HELP, CFrameWnd::OnHelpIndex)
  32. END_MESSAGE_MAP()
  33.  
  34. // The following array contains a list of command IDs for the toolbar.
  35. // They correspond to the order of the buttons in the IDR_MAINFRAME bitmap.
  36.  
  37. static UINT BASED_CODE buttons[] =
  38. {
  39.     ID_FILE_NEW,
  40.     ID_FILE_OPEN,
  41.     ID_FILE_SAVE,
  42.     ID_SEPARATOR,
  43.     ID_EDIT_CUT,
  44.     ID_EDIT_COPY,
  45.     ID_EDIT_PASTE,
  46.     ID_SEPARATOR,
  47.     ID_FILE_PRINT,
  48.     ID_APP_ABOUT,
  49.     ID_CONTEXT_HELP,
  50. };
  51.  
  52. // The following array contains a list of indicators for the status bar.
  53. // See AFXRES.H for a complete list.
  54.  
  55. static UINT BASED_CODE indicators[] =
  56. {
  57.     ID_SEPARATOR,         
  58.     ID_INDICATOR_CAPS,
  59.     ID_INDICATOR_NUM,
  60.     ID_INDICATOR_SCRL,
  61. };
  62.  
  63. //
  64. // CMainFrame constructor
  65. //
  66.  
  67. CMainFrame::CMainFrame()
  68. {
  69. }
  70.  
  71. //
  72. // CMainFrame destructor.
  73. //
  74.  
  75. CMainFrame::~CMainFrame()
  76. {
  77. }
  78.  
  79. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  80. {
  81.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1;
  82.  
  83.     if (!m_StatusBar.Create(this) ||
  84.         !m_StatusBar.SetIndicators(indicators,
  85.         sizeof(indicators)/sizeof(indicators[0]))) {
  86.         TRACE("Failed to create status bar in CMainFrame::OnCreate()\n");
  87.         return -1;                    
  88.     }
  89.  
  90. #if (_MFC_VER >= 0x0300)
  91.     if (!m_ToolBar.Create(this,
  92.         WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY) ||
  93. #else
  94.     if (!m_ToolBar.Create(this) ||
  95. #endif
  96.         !m_ToolBar.LoadBitmap(IDR_MAINFRAME) ||
  97.         !m_ToolBar.SetButtons(buttons, sizeof(buttons)/sizeof(buttons[0]))) {
  98.         TRACE("Failed to create toolbar in CMainFrame::OnCreate()\n");
  99.         return -1;
  100.     }
  101.  
  102. #if (_MFC_VER >= 0x0300)
  103.     m_ToolBar.EnableDocking(CBRS_ALIGN_ANY);
  104.     EnableDocking(CBRS_ALIGN_ANY);
  105.     DockControlBar(&m_ToolBar);
  106. #endif
  107.  
  108.     return 0;
  109. }
  110.  
  111. //
  112. // CMainFrame debug diagnostics
  113. //
  114.  
  115. #ifdef _DEBUG
  116. void CMainFrame::Dump(CDumpContext& dc) const
  117. {
  118.     CFrameWnd::Dump(dc);
  119. }
  120.  
  121. void CMainFrame::AssertValid() const
  122. {
  123.     CFrameWnd::AssertValid();
  124. }
  125.  
  126. #endif 
  127.  
  128. //
  129. // CMainFrame message handlers
  130. //
  131.